<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.spoto.oa.model.Sales" isELIgnored="false"%>
<%@ page import="com.spoto.oa.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="style/v1/common/welcome.css" rel="stylesheet">
		<script type="text/javascript" src="js/lib/jquery-1.4.2.js"></script>
		<script type="text/javascript" src="js/lib/jquery.validate.js"></script>
		<script src="js/common/list.js" type="text/javascript"></script>
	</head>
	<body>
		<div id="welcome">

			<%
				String op_type=request.getParameter("op_type");
				Object ob = request.getAttribute("salesList");
				if (null != ob) {
					PageUtil pc = new PageUtil();
					String searchType = request.getParameter("searchType");
					String info = request.getParameter("infor");
					pc.setCurrentPage(request.getParameter("page"));	//设置当前页面
					pc.setPageCount(20);		//设置每页记录数
					pc.setRecordCount(((List<Sales>) ob).size());	//设置记录条数
					pc.setPageUrl("SalesServlet?op_type=" + op_type + "&searchType="
							+ searchType + "&infor=" + info); //设置跳转页面url
					List<Sales> salesList = pc.getSubList((List<Sales>) ob); //获取当前页面记录
					if (salesList.isEmpty()) {
			%>
			<center style="padding:40px">
				无数据
			</center>
			<%
				} else {
			%>
			<div id="list">
				<div class="view">
					<form action="SalesServlet" method="post">
						<div id="table-ope-left">
							<input type="hidden" name="op_type" value="multi_invalid" />
						    <input type="hidden" name="formType" value="" id="formType"/>
							<button type="button" class="select_btn" name="select_all">全选</button>
							<button type="button" class="select_btn" name="select_reverse">反选</button>
							<button type="button" class="select_btn" name="select_cancel">取消</button>
							<input type="submit" id="mul-del" value="选中失效" />
						</div>
						<div id="table-ope-right">
							<%=pc.getPageJumpLinkHtml()%>
						</div>
						<div id="c"></div>
						<table class="table" cellspacing="0">
							<tr class="firstrow">
								<td>
									记录编号
								</td>
								<td>
									产品编号
								</td>
								<td>
									产品名称
								</td>
								<td>
									产品类型
								</td>
								<td>
									进价
								</td>
								<td>
									实际销价
								</td>
								<td>
									销售数量
								</td>
								<td>
									操作
								</td>
							</tr>
							<%
								int i = 0;
										for (Sales s : salesList) {
											i++;
							%>
	
	
							<tr>
								<td style="text-align:left">
									<input type="checkbox" name="invalid-flag" value="<%=s.getId() %>"/>
									<a  href="SalesServlet?op_type=to_update&id=<%=s.getId() %>">
									<% out.print(s.getId()); %>
									</a>					
								</td>
								<td>
									<%
										out.print(s.getProduct().getCode());
									%>
								</td>
								<td>
									<%
										out.print(s.getProduct().getName());
									%>
								</td>
								<td>
									<%
										out.print(s.getProduct().getType());
									%>
								</td>
								<td>
									<%
										out.print(s.getProduct().getPrice());
									%>
								</td>
								<td>
									<%
										out.print(s.getRealPrice());
									%>
								</td>
								<td>
									<%
										out.print(s.getNumbers());
									%>
								</td>
								<td>
									<a
										href="SalesServlet?id=<%=s.getId() %>&op_type=invalid"
										class="delete_a">失效</a>
								</td>
							</tr>

							<%
								}
							%>

						</table>
					</form>

					<div class="page-no">
						<ul>
							<%=pc.getJavaScriptJumpCode()%>
							<li id="statue">
								<%=pc.getPageCountHtml()%>
							</li>
							<li class="jump">
								<%=pc.getPageFormJumpHtml()%>
							</li>
						</ul>

					</div>

				</div>
				<%
					}
					}
				%>
			</div>

		</div>

	</body>
</html>
